
 <!DOCTYPE HTML>
<html >
<head>
  <meta charset="UTF-8">
  
    <title>dubbo免配置单元测试 | Typhoon&#39;s code space</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    
    <meta name="author" content="typhoon">
    

    
    <meta name="description" content="对于一个严谨的程序员,我们每开发一个程序,理论上都要经过单元测试的,经过单元测试我们可以发现比较简单的,低级的逻辑性错误,和sql语句错误等问题, 如果这些错误异常在测试阶段或者说生产环境出现,那么说明一个问题,我们的程序真的不够严谨,所以说单元测试是一个合格或者说优秀的开发人员必须具备的 一项技能。此篇不对单元测试做太多赘述,重点讲述一下dubbo服务化后我们怎样简单有效的做好单元测试">
<meta name="keywords" content="dubbo单元测试">
<meta property="og:type" content="article">
<meta property="og:title" content="dubbo免配置单元测试">
<meta property="og:url" content="http://scorpioaeolus.oschina.io/2017/08/05/dubbo免配置单元测试/index.html">
<meta property="og:site_name" content="Typhoon&#39;s code space">
<meta property="og:description" content="对于一个严谨的程序员,我们每开发一个程序,理论上都要经过单元测试的,经过单元测试我们可以发现比较简单的,低级的逻辑性错误,和sql语句错误等问题, 如果这些错误异常在测试阶段或者说生产环境出现,那么说明一个问题,我们的程序真的不够严谨,所以说单元测试是一个合格或者说优秀的开发人员必须具备的 一项技能。此篇不对单元测试做太多赘述,重点讲述一下dubbo服务化后我们怎样简单有效的做好单元测试">
<meta property="og:image" content="http://scorpioaeolus.oschina.io/typhoon/2017/08/05/dubbo免配置单元测试/dd.jpg">
<meta property="og:image" content="http://scorpioaeolus.oschina.io/typhoon/2017/08/05/dubbo免配置单元测试/dd.jpg">
<meta property="og:updated_time" content="2017-08-05T12:11:53.399Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="dubbo免配置单元测试">
<meta name="twitter:description" content="对于一个严谨的程序员,我们每开发一个程序,理论上都要经过单元测试的,经过单元测试我们可以发现比较简单的,低级的逻辑性错误,和sql语句错误等问题, 如果这些错误异常在测试阶段或者说生产环境出现,那么说明一个问题,我们的程序真的不够严谨,所以说单元测试是一个合格或者说优秀的开发人员必须具备的 一项技能。此篇不对单元测试做太多赘述,重点讲述一下dubbo服务化后我们怎样简单有效的做好单元测试">
<meta name="twitter:image" content="http://scorpioaeolus.oschina.io/typhoon/2017/08/05/dubbo免配置单元测试/dd.jpg">

    
    <link rel="alternative" href="/atom.xml" title="Typhoon&#39;s code space" type="application/atom+xml">
    
    
    <link rel="icon" href="/typhoon/img/java.png">
    
    
    <link rel="apple-touch-icon" href="/typhoon/img/jacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/typhoon/img/jacman.jpg">
    
    <link rel="stylesheet" href="/typhoon/css/style.css">
</head>

  <body>
    <header>
      
<div>
		
			<div id="imglogo">
				<a href="/typhoon/"><img src="/typhoon/img/java.png" alt="Typhoon&#39;s code space" title="Typhoon&#39;s code space"/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/typhoon/" title="Typhoon&#39;s code space">Typhoon&#39;s code space</a></h1>
				<h2 class="blog-motto"></h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="Menu">
			</a></div>
			<nav class="animated">
				<ul>
					<ul>
					 
						<li><a href="/typhoon/">主页</a></li>
					
						<li><a href="/typhoon/archives">归档</a></li>
					
						<li><a href="/typhoon/about">关于</a></li>
					
					<li>
 					
					<form class="search" action="//google.com/search" method="get" accept-charset="utf-8">
						<label>Search</label>
						<input type="search" id="search" name="q" autocomplete="off" maxlength="20" placeholder="Search" />
						<input type="hidden" name="q" value="site:scorpioaeolus.oschina.io">
					</form>
					
					</li>
				</ul>
			</nav>			
</div>
    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
  
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/typhoon/2017/08/05/dubbo免配置单元测试/" title="dubbo免配置单元测试" itemprop="url">dubbo免配置单元测试</a>
  </h1>
  <p class="article-author">By
       
		<a href="/typhoon/about" title="typhoon" target="_blank" itemprop="author">typhoon</a>
		
  <p class="article-time">
    <time datetime="2017-08-05T11:33:00.000Z" itemprop="datePublished"> Published 2017-08-05</time>
    
  </p>
</header>
	<div class="article-content">
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">Contents</strong>
		
			<ol class="toc"><li class="toc-item toc-level-5"><a class="toc-link" href="#一、点到点直连方式"><span class="toc-number">1.</span> <span class="toc-text">一、点到点直连方式</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#二、基于注册中心方式"><span class="toc-number">2.</span> <span class="toc-text">二、基于注册中心方式</span></a></li></ol>
		
		</div>
		
		<pre><code>对于一个严谨的程序员,我们每开发一个程序,理论上都要经过单元测试的,经过单元测试我们可以发现比较简单的,低级的逻辑性错误,和sql语句错误等问题,
如果这些错误异常在测试阶段或者说生产环境出现,那么说明一个问题,我们的程序真的不够严谨,所以说单元测试是一个合格或者说优秀的开发人员必须具备的
一项技能。此篇不对单元测试做太多赘述,重点讲述一下dubbo服务化后我们怎样简单有效的做好单元测试
</code></pre><a id="more"></a>
<pre><code>dubbo单元测试大概分两种,1.基于配置;2.免配置。相信各位使用过dubbo的看官对基于配置的单元测试都有所了解,接下来介绍一下免配置的dubbo单元测试案例
(点到点直连和基于配置中心)
</code></pre><h5 id="一、点到点直连方式"><a href="#一、点到点直连方式" class="headerlink" title="一、点到点直连方式"></a>一、点到点直连方式</h5><pre><code>在maven项目src/test目录下建立单元测试基类,如下:
</code></pre><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div></pre></td><td class="code"><pre><div class="line">/**</div><div class="line"> * 免配置dubbo服务单元测试</div><div class="line"> * </div><div class="line"> * @author Typhoon</div><div class="line"> * @date 2017-08-03 17:35 Thursday</div><div class="line"> * @since V1.3.1</div><div class="line"> * @param &lt;T&gt;</div><div class="line"> */</div><div class="line">public abstract class BaseTest1&lt;T&gt; &#123;	</div><div class="line">private ApplicationConfig application = null;</div><div class="line">private Class &lt;T&gt; clazz = (Class &lt;T&gt;) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];   </div><div class="line">private static final String dubboUrl = &quot;dubbo://10.1.8.76:10189&quot;;</div><div class="line">private static final String appName = &quot;zhenai-crm-center-test&quot;;</div><div class="line">public BaseTest1() &#123;</div><div class="line">application = new ApplicationConfig();</div><div class="line">application.setName(appName);</div><div class="line">&#125;</div><div class="line">T getService() &#123;</div><div class="line">// 引用远程服务</div><div class="line">ReferenceConfig&lt;T&gt; reference = new ReferenceConfig&lt;T&gt;(); </div><div class="line">// 此实例很重，封装了与注册中心的连接以及与提供者的连接，请自行缓存，否则可能造成内存和连接泄漏</div><div class="line">reference.setApplication(application);</div><div class="line">//reference.setRegistry(registry); // 多个注册中心可以用setRegistries()</div><div class="line">reference.setUrl(dubboUrl);</div><div class="line">reference.setInterface(clazz);</div><div class="line">reference.setTimeout(30000);</div><div class="line">// 和本地bean一样使用xxxService</div><div class="line">return reference.get(); // 注意：此代理对象内部封装了所有通讯细节，对象较重，请缓存复用</div><div class="line"> &#125;;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<pre><code>讲述一下几个含义,Application:我们每一个服务都需要依托于某个应用模块的,Clazz&lt;T&gt;:根据子类实现获取泛型类class类型,
dubboUrl:消费端需要直连的服务提供方,appName:当前应用名称。
重点是getService方法,直接将rpc服务本地化供本地服务调用,ReferenceConfig&lt;T&gt;:服务引用,等价于配置文件中&lt;dubbo:reference/&gt;节点,
设置一坨的Application,直连的服务地址,具体的服务接口,超时时间


根据要测试的接口写具体单元测试类
</code></pre><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">public class ComplaintInfoServiceTest1 extends BaseTest1&lt;ComplaintInfoService&gt; &#123;</div><div class="line">private static final Logger LOGGER = LoggerFactory.getLogger(ComplaintInfoServiceTest1.class);</div><div class="line">ComplaintInfoService complaintInfoService = this.getService();</div><div class="line">@Test</div><div class="line">public void testQueryByPK() &#123;</div><div class="line">ComplaintInfoDto dto = complaintInfoService.queryByPK(1L);</div><div class="line">LOGGER.info(&quot;响应:&#123;&#125;&quot;,JSON.toJSONString(dto));</div><div class="line">&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<pre><code>重点是第二行,this.getService()直接返回ComplaintInfoService接口服务实例,
然后就可以向本地服务一样写单元测试,效果如下:
</code></pre><img src="/typhoon/2017/08/05/dubbo免配置单元测试/dd.jpg" alt="result" title="result">
<h5 id="二、基于注册中心方式"><a href="#二、基于注册中心方式" class="headerlink" title="二、基于注册中心方式"></a>二、基于注册中心方式</h5><pre><code>配置中心使用的是zookeeper,我们需要对方式一的基类做改造如下:
</code></pre><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div></pre></td><td class="code"><pre><div class="line">/**</div><div class="line"> * 免配置dubbo服务单元测试</div><div class="line"> * </div><div class="line"> * @author Typhoon</div><div class="line"> * @date 2017-08-03 17:35 Thursday</div><div class="line"> * @since V1.3.1</div><div class="line"> * @param &lt;T&gt;</div><div class="line"> */</div><div class="line">public abstract class BaseTest1&lt;T&gt; &#123;</div><div class="line">private ApplicationConfig application = null;</div><div class="line">private RegistryConfig registry = null;</div><div class="line">private Class &lt;T&gt; clazz = (Class &lt;T&gt;) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];   </div><div class="line">private static final String zkUrl = &quot;t.zk01.jiebao.zhenai.com:6681,t.zk02.jiebao.zhenai.com:6682,t.zk03.jiebao.zhenai.com:6683&quot;;</div><div class="line">private static final String appName = &quot;zhenai-crm-center-test&quot;;</div><div class="line">public BaseTest1() &#123;</div><div class="line">application = new ApplicationConfig();</div><div class="line">application.setName(appName);</div><div class="line">// 连接注册中心配置</div><div class="line">registry = new RegistryConfig();</div><div class="line">registry.setProtocol(&quot;zookeeper&quot;);</div><div class="line">registry.setAddress(zkUrl);</div><div class="line">// 注意：ReferenceConfig为重对象，内部封装了与注册中心的连接，以及与服务提供方的连接</div><div class="line">&#125;</div><div class="line">T getService() &#123;</div><div class="line">// 引用远程服务</div><div class="line">ReferenceConfig&lt;T&gt; reference = new ReferenceConfig&lt;T&gt;(); // 此实例很重，封装了与注册中心的连接以及与提供者的连接，请自行缓存，否则可能造成内存和连接泄漏</div><div class="line">reference.setApplication(application);</div><div class="line">reference.setRegistry(registry); // 多个注册中心可以用setRegistries()</div><div class="line">//reference.setUrl(dubboUrl);</div><div class="line">reference.setInterface(clazz);</div><div class="line">reference.setTimeout(30000);</div><div class="line">// 和本地bean一样使用xxxService</div><div class="line">return reference.get(); // 注意：此代理对象内部封装了所有通讯细节，对象较重，请缓存复用</div><div class="line"> &#125;;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<pre><code>和方式一相比,该基类多了RegistryConfig,等价于&lt;dubbo:registry/&gt;节点,zkUrl就是要配置的zk路径(多个之间用逗号隔开),
getService方法不在使用直连的方式,这是了注册中心后会去配置中心找服务.


    接下来是基于注册中心的单元测试类
</code></pre><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">public class ComplaintInfoServiceTest1 extends BaseTest1&lt;ComplaintInfoService&gt; &#123;</div><div class="line">private static final Logger LOGGER = LoggerFactory.getLogger(ComplaintInfoServiceTest1.class);</div><div class="line">ComplaintInfoService complaintInfoService = this.getService();</div><div class="line">@Test</div><div class="line">public void testQueryByPK() &#123;</div><div class="line">ComplaintInfoDto dto = complaintInfoService.queryByPK(1L);</div><div class="line">LOGGER.info(&quot;响应:&#123;&#125;&quot;,JSON.toJSONString(dto));</div><div class="line">&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<pre><code>然后就可以向本地服务一样写单元测试,效果如下:
</code></pre><img src="/typhoon/2017/08/05/dubbo免配置单元测试/dd.jpg" alt="result" title="result">
<pre><code>其实我们根据真实业务场景分析,第二种是不太适用的,因为我们要测得基本上都是自己写的dubbo服务,所以基本上都是适用点点之间直连的方式,
而如果适用注册中心的花,有可能我们单元测试调用的服务是别人注册上去的或者是测试环境机器上的服务,然后就出现自己写单元测试测别人
服务。所以我们本地开发过程中都是适用第一种方式
</code></pre><p><strong>ps</strong>:以上两种方式在服务正常的情况下都能调用成功得到正确的响应结果,如果能帮到各位看官,是我的荣幸,<br>    如果觉得我写的不够好,请把板砖扔过来并提出宝贵意见</p>
  
	</div>
		<footer class="article-footer clearfix">
<div class="article-catetags">

<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/typhoon/categories/dubbo/">dubbo</a>
</div>


  <div class="article-tags">
  
  <span></span> <a href="/typhoon/tags/dubbo单元测试/">dubbo单元测试</a>
  </div>

</div>



	<div class="article-share" id="share">
	
	  <div data-url="http://scorpioaeolus.oschina.io/2017/08/05/dubbo免配置单元测试/" data-title="dubbo免配置单元测试 | Typhoon&#39;s code space" data-tsina="null" class="share clearfix">
	  </div>
	
	</div>


</footer>

   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/typhoon/2017/08/09/java性能优化实例分析/" title="java性能优化实例分析">
  <strong>上一篇：</strong><br/>
  <span>
  java性能优化实例分析</span>
</a>
</div>


<div class="next">
<a href="/typhoon/2017/07/27/motan使用zk/"  title="motan使用zk">
 <strong>下一篇：</strong><br/> 
 <span>motan使用zk
</span>
</a>
</div>

</nav>

	


</div>  
      <div class="openaside"><a class="navbutton" href="#" title="Show Sidebar"></a></div>

  <div id="toc" class="toc-aside">
  <strong class="toc-title">Contents</strong>
 
 <ol class="toc"><li class="toc-item toc-level-5"><a class="toc-link" href="#一、点到点直连方式"><span class="toc-number">1.</span> <span class="toc-text">一、点到点直连方式</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#二、基于注册中心方式"><span class="toc-number">2.</span> <span class="toc-text">二、基于注册中心方式</span></a></li></ol>
 
  </div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="Hide Sidebar"></a></div>
<aside class="clearfix">

  


  
<div class="categorieslist">
	<p class="asidetitle">Categories</p>
		<ul>
		
		  
			<li><a href="/typhoon/categories/dubbo/" title="dubbo">dubbo<sup>8</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/java性能优化/" title="java性能优化">java性能优化<sup>17</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/java源码分析/" title="java源码分析">java源码分析<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/motan/" title="motan">motan<sup>2</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/spring/" title="spring">spring<sup>11</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/springboot/" title="springboot">springboot<sup>28</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/springmvc/" title="springmvc">springmvc<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/容器/" title="容器">容器<sup>1</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/工具/" title="工具">工具<sup>7</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/性能优化/" title="性能优化">性能优化<sup>5</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/架构/" title="架构">架构<sup>8</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/案例分析/" title="案例分析">案例分析<sup>13</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/缓存/" title="缓存">缓存<sup>4</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/设计模式/" title="设计模式">设计模式<sup>3</sup></a></li>
		  
		
		  
			<li><a href="/typhoon/categories/面试题/" title="面试题">面试题<sup>1</sup></a></li>
		  
		
		</ul>
</div>


  
<div class="tagslist">
	<p class="asidetitle">Tags</p>
		<ul class="clearfix">
		
			
				<li><a href="/typhoon/tags/springboot/" title="springboot">springboot<sup>28</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/java性能优化/" title="java性能优化">java性能优化<sup>9</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/限流/" title="限流">限流<sup>3</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/Spring5/" title="Spring5">Spring5<sup>3</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/设计模式/" title="设计模式">设计模式<sup>3</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/案例分析/" title="案例分析">案例分析<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/性能优化/" title="性能优化">性能优化<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/Spring/" title="Spring">Spring<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/dubbo/" title="dubbo">dubbo<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/分页/" title="分页">分页<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/并发/" title="并发">并发<sup>2</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/异常拦截/" title="异常拦截">异常拦截<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/dubbo分布式事务/" title="dubbo分布式事务">dubbo分布式事务<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/自带图片/" title="自带图片">自带图片<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/svn导出mvn项目/" title="svn导出mvn项目">svn导出mvn项目<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/dubbo过滤器/" title="dubbo过滤器">dubbo过滤器<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/排序性能对比/" title="排序性能对比">排序性能对比<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/ListenableFuture/" title="ListenableFuture">ListenableFuture<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/PropertyChangeListener/" title="PropertyChangeListener">PropertyChangeListener<sup>1</sup></a></li>
			
		
			
				<li><a href="/typhoon/tags/jdbcTemplate高可用/" title="jdbcTemplate高可用">jdbcTemplate高可用<sup>1</sup></a></li>
			
		
		</ul>
</div>


  <div class="linkslist">
  <p class="asidetitle">Links</p>
    <ul>
        
          <li>
            
            	<a href="https://coderq.com" target="_blank" title="一个面向程序员交流分享的新一代社区">码农圈</a>
            
          </li>
        
          <li>
            
            	<a href="http://wuchong.me" target="_blank" title="Jark&#39;s Blog">Jark&#39;s Blog</a>
            
          </li>
        
    </ul>
</div>

  


  <div class="rsspart">
	<a href="/atom.xml" target="_blank" title="rss">RSS</a>
</div>

  <div class="weiboshow">
  <p class="asidetitle">Weibo</p>
    <iframe width="100%" height="119" class="share_self"  frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=119&fansRow=2&ptype=1&speed=0&skin=9&isTitle=1&noborder=1&isWeibo=0&isFans=0&uid=null&verifier=b3593ceb&dpc=1"></iframe>
</div>


</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	<div class="line">
		<span></span>
		<div class="author"></div>
	</div>
	
	
	<section class="info">
		<p> Hello ,I&#39;m a java coder. <br/>
			This is my blog,believe it or not.</p>
	</section>
	 
	<div class="social-font" class="clearfix">
		
		
		
		
		
		
		
		
		
		
		<a href="mailto:ScorpioAeolus@163.com" target="_blank" class="icon-email" title="Email Me"></a>
		
	</div>
			
		

		<p class="copyright">
		Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/wuchong/jacman" target="_blank" title="Jacman">Jacman</a> © 2019 
		
		<a href="/typhoon/about" target="_blank" title="typhoon">typhoon</a>
		
		
		</p>
</div>
</footer>
    <script src="/typhoon/js/jquery-2.0.3.min.js"></script>
<script src="/typhoon/js/jquery.imagesloaded.min.js"></script>
<script src="/typhoon/js/gallery.js"></script>
<script src="/typhoon/js/jquery.qrcode-0.12.0.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
  
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else{
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
      
      $('#toc.toc-aside').css('display', 'none');
        
    }
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  c.click(function(){
    ta.css('display', 'block').addClass('fadeIn');
  });
  o.click(function(){
    ta.css('display', 'none');
  });
  $(window).scroll(function(){
    ta.css("top",Math.max(140,320-$(this).scrollTop()));
  });
});
</script>


<script type="text/javascript">
$(document).ready(function(){ 
  var $this = $('.share'),
      url = $this.attr('data-url'),
      encodedUrl = encodeURIComponent(url),
      title = $this.attr('data-title'),
      tsina = $this.attr('data-tsina'),
      description = $this.attr('description');
  var html = [
  '<div class="hoverqrcode clearfix"></div>',
  '<a class="overlay" id="qrcode"></a>',
  '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
  '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
  '<a href="#qrcode" class="article-share-qrcode" title="微信"></a>',
  '<a href="http://widget.renren.com/dialog/share?resourceUrl=' + encodedUrl + '&srcUrl=' + encodedUrl + '&title=' + title +'" class="article-share-renren" target="_blank" title="人人"></a>',
  '<a href="http://service.weibo.com/share/share.php?title='+title+'&url='+encodedUrl +'&ralateUid='+ tsina +'&searchPic=true&style=number' +'" class="article-share-weibo" target="_blank" title="微博"></a>',
  '<span title="Share to"></span>'
  ].join('');
  $this.append(html);

  $('.hoverqrcode').hide();

  var myWidth = 0;
  function updatehoverqrcode(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
    var qrsize = myWidth > 1024 ? 200:100;
    var options = {render: 'image', size: qrsize, fill: '#2ca6cb', text: url, radius: 0.5, quiet: 1};
    var p = $('.article-share-qrcode').position();
    $('.hoverqrcode').empty().css('width', qrsize).css('height', qrsize)
                          .css('left', p.left-qrsize/2+20).css('top', p.top-qrsize-10)
                          .qrcode(options);
  };
  $(window).resize(function(){
    $('.hoverqrcode').hide();
  });
  $('.article-share-qrcode').click(function(){
    updatehoverqrcode();
    $('.hoverqrcode').toggle();
  });
  $('.article-share-qrcode').hover(function(){}, function(){
      $('.hoverqrcode').hide();
  });
});   
</script>









<link rel="stylesheet" href="/typhoon/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/typhoon/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.article-content').each(function(i){
    $(this).find('img').each(function(){
      if ($(this).parent().hasClass('fancybox')) return;
      var alt = this.alt;
      if (alt) $(this).after('<span class="caption">' + alt + '</span>');
      $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
    });
    $(this).find('.fancybox').each(function(){
      $(this).attr('rel', 'article' + i);
    });
  });
  if($.fancybox){
    $('.fancybox').fancybox();
  }
}); 
</script>



<!-- Analytics Begin -->



<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?e6d1f421bbc9962127a50488f9ed37d1";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>



<!-- Analytics End -->

<!-- Totop Begin -->

	<div id="totop">
	<a title="Back to Top"><img src="/typhoon/img/scrollup.png"/></a>
	</div>
	<script src="/typhoon/js/totop.js"></script>

<!-- Totop End -->

<!-- MathJax Begin -->
<!-- mathjax config similar to math.stackexchange -->


<!-- MathJax End -->

<!-- Tiny_search Begin -->

<!-- Tiny_search End -->

  </body>
</html>
